<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作用域</title>
</head>
<body>
<script type="text/javascript">
    var num=100;
    var obj={
        num:200,
        inner:{
            num:300,
            print:function () {
                console.log(this);
                console.log("this.name---------->"+this.num);
            }
        }
    }
//    obj.inner.print();
    var func=obj.inner.print;
//    func();
    func.call(obj);
//    (obj.inner.print)();
//    (obj.inner.print=obj.inner.print)();

    var num=100;
    function print() {
        console.log(num);
        var num=function () {
            return 122;
        };
    }
    print();

    (function(num) {
        console.log(num);
        var num=10;
        /*function num() {
            return 122
        }*/
    })(100)
</script>
</body>
</html>